#ifndef CARD_H
#define CARD_H

#include <QWidget>
#include "networkmanager.h"
// 前向声明
class Widget;
class Log;
class Bill;
namespace Ui {
class Card;
}

class Card : public QWidget
{
    Q_OBJECT

public:
    explicit Card(QWidget *parent = nullptr);
    ~Card();
    void setWidget(Widget *w);
    void setLog(Log *l);
    void setBill(Bill *b);
     void setNetworkManager(NetworkManager *manager);
private slots:
    void on_pushButton_home_clicked(); //点击跳转到主页界面
    void on_pushButton_log_clicked();  //点击跳转到日志界面
    void on_pushButton_bill_clicked();//点击跳转到账单界面
    void on_pushButton_registered_clicked();
    void on_pushButton_recharge_clicked();
    void on_pushButton_remaining_days_clicked();
    void on_pushButton_membership_information_clicked();
public slots:
    void onDataReceived(const QByteArray &data); //处理接收到的数据
private:
    Ui::Card *ui;
    Widget *widget;  // 指向主页窗口
    Log *log;       // 指向日志窗口
    Bill *bill;  //指向账单窗口
    NetworkManager *networkManager; //网络通信管理

    //用于标记是否开始接收会员信息
    bool isReceivingMembershipInfo = false;
    QString membershipCsvData;
};

#endif // CARD_H
